package com.xy.dynamicproxy;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/15 21:37
 * @description
 */
public class Client {
    public static void main(String[] args) {
        // 被代理对象
        TeacherDao target = new TeacherDao();

        // 创建代理对象
        ITeacherDao proxyITeacher = (ITeacherDao)new ProxyFactory(target).getProxyInstance();
        proxyITeacher.teach();

        System.out.println("-------------");

        Test test = (Test)new ProxyFactory((Test) () ->
                System.out.println("this is a test")
        ).getProxyInstance();
        test.test();
    }
}
